package org.emet.entity.biz;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.emet.help.CGResource;
import org.emet.jee.console.entity.BaseEntity;

@Entity
@Table(name = "T_CHARGE_ITEM")
public class ChargeItem extends BaseEntity {
	private ChargeRecord chargeRecord;

	private String code;
	private String detailName;
	private Long chargeId;
	// For now, there are only 5 types: service(S) and item(I)
	/**
	 * String CARRIAGE = "CA"; String CEREMONY = "CE"; String CREMATION_HIST =
	 * "CH"; String FREEZER_RENT = "FR"; String HALL_RENT = "HR";
	 */
	private String type;
	private String unit;
	private Integer count;
	private double singleFee;
	private String remark;

	// 总费用
	@CGResource("总费用")
	private double totalFee;
	// 应付费用
	@CGResource("应付费用")
	private double shouldPaidTotalFee;
	// 已付总费用
	@CGResource("已付总费用")
	private double paidFee;

	public Long getChargeId() {
		return chargeId;
	}

	public void setChargeId(Long chargeId) {
		this.chargeId = chargeId;
	}

	@ManyToOne(targetEntity = ChargeRecord.class)
	@JoinColumn(name = "rec_id")
	public ChargeRecord getChargeRecord() {
		return chargeRecord;
	}

	public void setChargeRecord(ChargeRecord chargeRecord) {
		this.chargeRecord = chargeRecord;
	}

	public String getDetailName() {
		return detailName;
	}

	public void setDetailName(String detailName) {
		this.detailName = detailName;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getUnit() {
		return unit;
	}

	public void setUnit(String unit) {
		this.unit = unit;
	}

	public Integer getCount() {
		return count;
	}

	public void setCount(Integer count) {
		this.count = count;
	}

	public double getSingleFee() {
		return singleFee;
	}

	public void setSingleFee(double singleFee) {
		this.singleFee = singleFee;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public double getTotalFee() {
		return totalFee;
	}

	public void setTotalFee(double totalFee) {
		this.totalFee = totalFee;
	}

	public double getShouldPaidTotalFee() {
		return shouldPaidTotalFee;
	}

	public void setShouldPaidTotalFee(double shouldPaidTotalFee) {
		this.shouldPaidTotalFee = shouldPaidTotalFee;
	}

	public double getPaidFee() {
		return paidFee;
	}

	public void setPaidFee(double paidFee) {
		this.paidFee = paidFee;
	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}
}
